<%-- 
    Document   : tryOptions
    Created on : 11-mar-2012, 20:27:02
    Author     : Alvaro
--%>

<%@page import="java.util.List"%>
<%@page import="classes.user"%>
<%@page import="classes.AdminDB"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <script language="JavaScript">
            function Abrir_ventana (pagina) {
                var opciones="toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=508, height=350, top=85, left=140";
                window.open(pagina,"",opciones);
            }
        </script>
        <link href="shopStyles.css" rel="stylesheet" type="text/css"> <!-- guardamos el css en la raiz porque sino hay cosas que no funcionan -->

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Options</title>
        <style type="text/css">
            a:link {
                text-decoration: none;
            }
            a:visited {
                text-decoration: none;
            }
            a:hover {
                text-decoration: none;
            }
            a:active {
                text-decoration: none;
            }
        </style>
    </head>
    <body link="#8C0F0F">
        <%@ page language="java" %>

        <%
            String cookieName = "email";
            Cookie cookies[] = request.getCookies();

            Cookie email = null;
            if (cookies != null) {
                for (int i = 0; i < cookies.length; i++) {
                    if (cookies[i].getName().equals(cookieName)) {
                        email = cookies[i];

                        break;
                    }
                }

            }

        %>

        <%



            AdminDB adb = new AdminDB();
            user u = new user();
            List<user> users;

            String email2 = email.getValue();
            String by = "email";

            users = u.searchUsers(adb.getConnection(), email2, by);
        %>



        <div class="container">
            <div class="header">

                <table width="100%" border="0">
                    <tr>
                        <td><img src="images/logoshop2.png" width="410" height="165" alt="shop"></td>
                        <td align="right"><img src="images/flag copia.png" width="149" height="123" alt="yourf1store">
                            <!-- Boton me gusta de facebook -->
                            <div class="fb-like" data-send="true" data-layout="button_count" data-width="100" data-show-faces="true"></div>



                            <!-- SiteSearch Google -->
                            <FORM method="get" action="http://www.google.com/search">
                                <input type=hidden name=ie value=UTF-8>
                                <input type=hidden name=oe value=UTF-8>
                                <TABLE bgcolor="#F27405" class="borderSearchRightDown"><tr>
                                        <td class="borderSearchRightDown">
                                            <INPUT TYPE="search" name="q" size="31" maxlength="255" value="" placeholder="Search something you want...">
                                            <INPUT type="submit" name="btnG" VALUE="Buscar en sitio">
                                            <font size=-1>
                                            <input type="hidden" name="domains" value="index.jsp"><br><input type="radio" name="sitesearch" value=""> 
                                            <span class="fontSpecial">WWW</span>
                                            <input type="radio" name="sitesearch" value="index.jsp" checked>
                                            <span class="fontSpecial">F1 store</span><br>
                                            </font>

                                        </td></tr></TABLE>
                                <div align="right">
                                    <!-- Reconocimiento de usuario -->


                                    <label><strong><%if (email != null) {%><%=email.getValue()%></strong> | <a href="javascript:Abrir_ventana('logout_popup.jsp')"><font size="1" face="Verdana">logout</font></a> </label>
                                    <label> | <a href="options.jsp"><font size="1" face="Verdana">options</font></a></label> 
                                            <%} else {

                                            %>
                                    <label><strong> Unknown user |</strong></label> <a href="login.jsp">Login</a>
                                    <%}%>

                                    <!-- Fin reconocimiento del usuario -->    



                                    <img src="images/eng.gif" width="20" height="15" alt="eng">   
                                    <img src="images/esp.gif" width="20" height="15" alt="esp"> 
                                    <img src="images/fra.gif" width="20" height="15" alt="fra"> 
                                    <img src="images/ger.gif" width="20" height="15"> 
                                    <img src="images/por.gif" width="20" height="15" alt="por"> 
                                    <a href="#final" class="fontSpecialLanguageChooser"><font size="1" face="Verdana">Choose language</font></a></div>

                            </FORM>
                    </tr>
                </table>

            </div>
        </div>

        <div class="container">
            <div class="header">
                <ul class="menu">    
                    <li><a href="index.jsp"><span>Home</span></a></li>
                    <% if (email == null) {
                    %>

                    <li><a href="login.jsp"><span>Login</span></a></li>
                    <li><a href="signup.jsp"><span>Signup</span></a></li>

                    <%} else {%>
                    <li><a href="logout_popup.jsp"><span>Logout</span></a></li>
                    <li><a href="options.jsp"><span>Options</span></a></li>
                    <%}%>      
                    <li onClick="about()"><a href="#"><span>About</span></a></li>
                    <li><a href="contact.jsp"><span>Contact</span></a></li>
                    <li><a href="cars.jsp"><span>Cars</span></a></li>
                    <li><a href="/Apparel"><span>Apparel</span></a></li>
                    <li><a href="gadgets.jsp"><span>Gadgets</span></a></li>
                    <li><a href="/CarAccessories"><span>Car Accesories</span></a></li>
                    <li><a href="search.jsp"><span>Search</span></a></li>
                    <li><a href="Scart.jsp"><span>Cart</span></a></li>

                </ul>

            </div>
        </div>

        <div class="container">
            <div class="content">    




                <div class="container">
                    <div class="content">    


                        <div align="center">
                            <%
                        if(email.getValue().equals("F1Guest")){%>
                          <h3 align="center">Personal Information                   </h3>
                        <div align="center">
                            <table width="60%" border="0">
                                <tr>
                                    <th width="78%" scope="col"><div align="left">
                                    <table width="95%" class="popup">
                                        <tr>
                                            <td><strong>Logged as guest.</strong></td>
                                        </tr>
                                        
                                        
                                    </table>
                                </div></th>
                                </tr>
                            </table>
                        </div>  
                        <%}
                            
                        if (users == null) {%>
                        </div>
                        <label>
                            <div align="center"><img src="images/lists.png"></div>
                        </label>
                        <div align="center">
                            <%} else {
                                for (user u1 : users) {
                            %>

                        </div>
                        <h3 align="center"><a href="options.jsp">User Information</a> | <a href="orderInfo.jsp">Order Information</a></h3>
                        <h3 align="center">Personal Information                   </h3>
                        <div align="center">
                            <table width="60%" border="0">
                                <tr>
                                    <th width="22%" align="right" scope="col"><img src="<%=u1.getDir()%>" width="120" height="150" class="borderImages"></th>
                                    <th width="78%" scope="col"><div align="left">
                                    <table width="95%" class="popup">
                                        <tr>
                                            <td><strong>Name:</strong> <%=u1.getName()%></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Last Name:</strong> <%=u1.getSecondname()%></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Email:</strong> <%=u1.getEmail()%></td>
                                        </tr>
                                        <tr>
                                            <td><strong>Money: </strong> <%=u1.getMoney()%> €</td>
                                        </tr>
                                        <tr>
                                            <td><div align="center"><a href="javascript:Abrir_ventana('changepersonalinfo_popup.jsp')"><font size="1" face="Verdana">Change</font></a></div></td>
                                        </tr>
                                    </table>
                                </div></th>
                                </tr>
                            </table>
                        </div>
                        <form action="/ShopOnline/changePhotoUser" method="post" enctype="multipart/form-data" name="userphoto">
                            <div align="center">
                                <table width="73%" border="0">
                                    <tr>
                                        <td width="45%"><div align="right">Upload photo</div></td>
                                        <td width="55%"><label for="file"></label>
                                            <input type="file" name="file" id="file"></td>
                                    </tr>
                                </table>
                                <input type="hidden" name="email" id="email" value="<%=u1.getEmail()%>">
                                <input type="submit" name="uploadphoto" id="uploadphoto" value="Add">
                            </div>
                        </form>
                        <div align="center"><br>
                        </div>
                        <h3 align="center">Shipping Information</h3>
                        <div align="center">
                            <table width="30%" class="popup">
                                <tr>
                                    <td><strong>Country: </strong> <%=u1.getCountry()%></td> 
                                </tr>
                                <tr>
                                    <td><strong>City: </strong> <%=u1.getCity()%></td>  
                                </tr>
                                <tr>
                                    <td><strong>Street: </strong> <%=u1.getStreet()%></td>
                                </tr>
                                <tr>
                                    <td><strong>Zip: </strong> <%=u1.getZip()%></td> 
                                </tr>
                                <tr>
                                    <td><strong>Number: </strong> <%=u1.getNumber()%></td> 
                                </tr>
                                <tr>
                                    <td><strong>Floor: </strong> <%=u1.getFloor()%></td>  
                                </tr>
                                <tr>
                                    <td><strong>Letter: </strong> <%=u1.getLetter()%></td>
                                </tr>
                                <tr>
                                    <td align="center"><label class="fontSpecial"><a href="javascript:Abrir_ventana('changeshipinfo_popup.jsp')"><font size="1" face="Verdana">Change</font></a></label></td>
                                </tr>
                            </table>
                        </div>
                        <h3 align="center">Password Information</h3>
                        <div align="center">
                            <table width="30%" class="popup">
                                <tr>
                                    <td><strong>Password</strong> <%=u1.getPass()%></td> 
                                </tr>  
                                <tr>
                                    <td align="center"><label class="fontSpecial"><a href="javascript:Abrir_ventana('changepasswordinfo_popup.jsp')"><font size="1" face="Verdana">Change</font></a></label></td>
                                </tr>
                            </table>
                            <%}
                              }%>
                            <br>
                            <br>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="container">
            <div class="footer">
                <h5 align="center" class="white">Alvaro F1 online shop - Your F1 store</h5>
                <a name="final"></a><!-- Marcador para ir al final de la pagina -->
                <div id="google_translate_element" align="center"></div>
                <div align="center">
                    <script>
                        function googleTranslateElementInit() {
                            new google.translate.TranslateElement({
                                pageLanguage: 'es'
                            }, 'google_translate_element');
                        }
                    </script>
                    <script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
                    <img src="images/footerShop.png" width="940" height="74" alt="footer"></div>
            </div>
        </div>
        <br>
        <br>      
    </body>
</html>
